package com.atchangsha.system.controller;

import java.util.Arrays;
import java.util.Map;
import org.springframework.web.bind.annotation.*;
import com.atchangsha.system.entity.CustomerCouponRelationEntity;
import com.atchangsha.system.service.CustomerCouponRelationService;
import com.atchangsha.system.common.utils.PageUtils;
import com.atchangsha.system.common.utils.Result;
import javax.annotation.Resource;

/**
 * @author 卓越班项目第二组
 * @date 2022-06-01 21:38:28
 */
@RestController
@RequestMapping("system/customerCouponRelation")
public class CustomerCouponRelationController {
    @Resource
    private CustomerCouponRelationService customerCouponRelationService;

    /**
     * 列表
     */
    @GetMapping("/list")
    public Result list(@RequestParam Map<String, Object> params){
        PageUtils page = customerCouponRelationService.queryPage(params);

        return Result.ok().setResult(page);
    }


    /**
     * 信息
     */
    @GetMapping("/info/{id}")
    public Result info(@PathVariable("id") Long id){
		CustomerCouponRelationEntity customerCouponRelation = customerCouponRelationService.getById(id);

        return Result.ok().setResult(customerCouponRelation);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public Result save(@RequestBody CustomerCouponRelationEntity customerCouponRelation){
		customerCouponRelationService.save(customerCouponRelation);

        return Result.ok();
    }

    /**
     * 修改
     */
    @PutMapping("/update")
    public Result update(@RequestBody CustomerCouponRelationEntity customerCouponRelation){
		customerCouponRelationService.updateById(customerCouponRelation);

        return Result.ok();
    }

    /**
     * 删除
     */
    @DeleteMapping("/delete")
    public Result delete(@RequestBody Long[] ids){
		customerCouponRelationService.removeByIds(Arrays.asList(ids));

        return Result.ok();
    }

}
